
#include "gmatlab.h"

// mxArray * g_irepository_matlab_get_search_path();
void mexFunction(int nlhs, mxArray *lhs[], int nrhs, const mxArray *rhs[])
{
  GSList *list, *path = g_irepository_get_search_path();
  mwSize num;
  int i;

  if (nrhs != 0) g_matlab_error("gmatlab:numArg", "g_irepository_matlab_get_search_path() takes 0 arguments");
  if (nlhs != 1) g_matlab_error("gmatlab:numRet", "g_irepository_matlab_get_search_path() has 1 return value");
  
  for(list=path, num=0; list; num++) list = g_slist_next(list);
  
  lhs[0] = mxCreateCellMatrix(1, num);
  for (list=path, i=0; i < num; i++, list=g_slist_next(list))
    mxSetCell(lhs[0], i, g_matlab_mxArray_from_utf8(list->data));
}
